home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / conhlp.arc / HEADER.ASM < prev    next >
Assembly Source File  |  1988-11-11  |  7KB  |  271 lines

  1. ; HEADER.ASM
  2.  
  3.     name    ConsoleHelpPreludeModule
  4.  
  5. DGROUP    GROUP    _DATA
  6.  
  7. PGROUP    GROUP    _TEXT
  8.     assume cs:PGROUP, ds:DGROUP
  9.  
  10. _TEXT    segment public 'CODE'
  11.  
  12.     ;VAP definitions
  13.     public    NetWareShellServices, ProcessControlServices
  14.     public     ConsoleControlServices, IPXSPXServices
  15.  
  16.     ;external routines
  17.     extrn    _ConsoleHandler: near, _DownHandler: near, _Main: near
  18.  
  19.     ;VAP Header
  20.     Signature            db    'NWProc'
  21.     NetWareShellServices        dd    ?
  22.     ProcessControlServices        dd    ?
  23.     ConsoleControlServices        dd    ?
  24.     IPXSPXServices            dd    ?
  25.     VAPConsoleHandler        dd    ConsoleHandlerCALL
  26.     VAPDownHandler            dd    DownHandlerCALL
  27.     VAPConsoleOrDownDataSegment    dw    DGroup
  28.     VAPConnectionRequestFlag    dw    0      ; Connection Needed
  29.     VAPNameString            db    'Console Help VAP.', 64-($-VAPNameString) dup(0)
  30.     VAPConsoleKeyWordCount        dw    18
  31.     VAPKeyword0            db    '? P', 16-($-VAPKeyword0) dup(0)
  32.     VAPKeyword1            db    '? PRINTER', 16-($-VAPKeyword1) dup(0)
  33.     VAPKeyword2            db    '? Q', 16-($-VAPKeyword2) dup(0)
  34.     VAPKeyword3            db    '? QUEUE', 16-($-VAPKeyword3) dup(0)
  35.     VAPKeyword4            db    '? D', 16-($-VAPKeyword4) dup(0)
  36.     VAPKeyword5            db    '? DISK', 16-($-VAPKeyword5) dup(0)
  37.     VAPKeyword6            db    '? S', 16-($-VAPKeyword6) dup(0)
  38.     VAPKeyword7            db    '? SERVER', 16-($-VAPKeyword7) dup(0)
  39.     VAPKeyword8            db    '? M', 16-($-VAPKeyword8) dup(0)
  40.     VAPKeyword9            db    '? MESSAGE', 16-($-VAPKeyword9) dup(0)
  41.     VAPKeyword10            db    '? C', 16-($-VAPKeyword10) dup(0)
  42.     VAPKeyword11            db    '? CONNECTION', 16-($-VAPKeyword11) dup(0)
  43.     VAPKeyword12            db    '? V', 16-($-VAPKeyword12) dup(0)
  44.     VAPKeyword13            db    '? VAP', 16-($-VAPKeyword13) dup(0)
  45.     VAPKeyword14            db    '? O', 16-($-VAPKeyword14) dup(0)
  46.     VAPKeyword15            db    '? OTHER', 16-($-VAPKeyword15) dup(0)
  47.     VAPKeyword16            db    '?', 16-($-VAPKeyword16) dup(0)
  48.     VAPKeyword17            db    'HELP', 16-($-VAPKeyword17) dup(0)
  49.     VAPSignOnMessage        db       10,13,'╔═══════════════════════════════════════════════════════╗',13,10
  50.                     db          '║             File Server Console HELP                  ║',13,10
  51.                     db          '║      -An online help utility for console commands     ║',13,10
  52.                     db          '╚═══════════════════════════════════════════════════════╝',13,10,0
  53.                     db    500-($-VAPSignOnMessage) dup(0)
  54.      
  55. VAPStart    proc    near
  56.     mov    ax, DGroup
  57.     mov    di, 1            ;change segment to data (read/write)
  58.     call     dword ptr cs:ProcessControlServices
  59.     cli
  60.     mov    ax, DGroup
  61.     mov    ds, ax
  62.     mov    es, ax
  63.     mov    ss, ax
  64.     mov    ax, OFFSET DGroup:MainStackEnd     
  65.     mov    sp, ax
  66.     sti
  67.     mov    ax, PGroup
  68.     mov    _MyHeaderSegment, ax
  69.     call    _Main               
  70. VAPStart    endp
  71.  
  72. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  73. ;; Handler front-ends
  74. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  75.  
  76. ConsoleHandlerCALL    proc    far
  77.     mov    _Keyword, ax
  78.     call    _ConsoleHandler
  79.     ret
  80. ConsoleHandlerCALL    endp
  81.  
  82. DownHandlerCALL        proc    far
  83.     call    _DownHandler
  84.     ret
  85. DownHandlerCALL        endp
  86.  
  87. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  88. ;; Misc Procedures
  89. ;;    MSC stack check fake-out
  90. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  91.     public    __CHKSTK
  92.     public    _VGetCurrentDisk
  93.     public    _VOpen
  94.     public    _VClose
  95.     public    _VRead
  96.     public    _VGetFileServerName
  97.     public    _VInString
  98.     public    _VSeek
  99.  
  100. ;Parameters and Usage:
  101. ;    ccode = VOpen( filename, mode, &handle );
  102. _VOpen        proc    near
  103.     push    bp
  104.     mov    bp, sp
  105.     push    ds
  106.     mov     si, [bp + 6]        ;put mode into AL
  107.     mov     ax, si
  108.     mov    ah, 3dh
  109.     mov    dx, [bp + 4]
  110.     call    dword ptr cs: NetWareShellServices
  111.     jc    OpenFailure
  112. OpenSuccess:
  113.     mov    si, [bp + 8]
  114.     mov    [si], ax
  115.     xor    ax, ax
  116.     jmp    OpenDone
  117. OpenFailure:
  118.     mov    si, [bp + 8]
  119.     mov    word ptr [si], -1
  120. OpenDone:
  121.     pop    ds
  122.     pop    bp
  123.     ret    
  124. _VOpen        endp
  125. ;
  126. ;Parameters and Usage:
  127. ;    ccode = VClose( handle );
  128. _VClose        proc    near
  129.     push    bp
  130.     mov    bp, sp
  131.     mov    al, [bp+4]
  132.     mov    ah, 3Eh
  133.  
  134.     call    dword ptr cs: NetWareShellServices
  135.  
  136.     pop    bp
  137.     ret
  138. _VClose        endp
  139. ;
  140. ;Usage:    bytesRead = VRead( int handle, char *buffer, int count );
  141. ;
  142. _VRead    proc    near
  143.     push    bp
  144.     mov    bp, sp
  145.  
  146.     mov    bx, [bp+4]        ;Handle
  147.     mov    dx, [bp+6]        ;Buffer
  148.     mov    cx, [bp+8]        ;Count
  149.  
  150.     mov    ah, 3Fh
  151.  
  152.     call    dword ptr cs: NetWareShellServices
  153.  
  154.     jnc    ReadDone        ;Carry Set means error
  155.     mov    ax, -1            ;Return a -1
  156. ReadDone:
  157.     pop    bp
  158.     ret    
  159. _VRead    endp
  160.  
  161. __CHKSTK    proc    near
  162.     pop    cx            ; get return offset
  163.     sub    sp,ax            ; allocate stack space
  164.     jmp    cx            ; return to cx
  165. __CHKSTK    endp
  166.  
  167. _VGetCurrentDisk    proc    near
  168.     mov    ax, 019FFh
  169.     call    dword ptr cs:NetWareShellServices
  170.     ret
  171. _VGetCurrentDisk    endp
  172. ;
  173. ; Usage: ccode = VGetFileServerName( char * buffer);
  174. ;        (ccode will contain 0 if on file server, 1 if on a bridge)
  175. ;
  176. _VGetFileServerName    proc    near
  177.     push    bp
  178.     mov    bp, sp
  179.     push    es
  180.     mov    si, DGroup
  181.     mov    es, si
  182.     mov    si, [bp + 4]     
  183.     mov    di, 14h                                                        ;load the read function into AH
  184.     call    dword ptr cs: ProcessControlServices
  185.     xor    ah, ah
  186.     pop    es
  187.     pop    bp
  188.     ret        
  189. _VGetFileServerName    endp
  190. ;
  191. ; USAGE: newPointer = VSeek( int handle, long offset, int loc );
  192. ; NOTE: newPointer is a long
  193. ;     loc can be:    0 (beginning of file) 
  194. ;            1 (current location in file)
  195. ;            2 (end of file)
  196. ;
  197. _VSeek    proc    near
  198.     push    bp
  199.     mov    bp, sp
  200.     
  201.     push    ax
  202.     push    bx
  203.     push    cx
  204.     push    dx
  205.  
  206.     mov    bx, [bp+4]        ;Handle
  207.     mov    dx, [bp+6]        ;Offset (passed as a long)
  208.     mov    cx, [bp+8]        ;Offset (continued)
  209.     mov    al, [bp+10]        ;Seek relative to this location
  210.     mov    ah, 42h
  211.  
  212.     call    dword ptr cs: NetWareShellServices
  213.  
  214.     jnc    SeekDone        ;Carry means error
  215.     mov    ax, -1            ;Return a -1
  216.  
  217. SeekDone:
  218.     pop    dx
  219.     pop    cx
  220.     pop    bx
  221.     pop    di
  222.     pop    bp
  223.     ret    
  224. _VSeek    endp
  225. ;
  226. ; Usage: actualLength = VInString( int row, int col, char *prompt,
  227. ;                    char *buffer, int buffLength ); 
  228. ;
  229. _VInString    proc    near
  230.     push    bp
  231.     mov    bp, sp
  232.  
  233.     push    ds
  234.     pop    es
  235.     mov    ah, byte ptr [bp + 4]                ;row coordinate
  236.     mov    al, byte ptr [bp + 6]                ;column coordinate
  237.     mov    si, [bp + 8]                    ;pointer to prompt message
  238.     mov    di, [bp + 10]                    ;pointer to input buffer
  239.     mov    bx, di
  240.     mov    dl, byte ptr [bp + 12]                ;input buffer length
  241.     mov    di, 11        
  242.  
  243.     call    dword ptr cs: ConsoleControlServices
  244.  
  245.     pop    bp
  246.     ret
  247. _VInString    endp
  248.  
  249. _TEXT    ends
  250.  
  251. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  252. ;; Data definitions
  253. ;;    Define all stacks for all processes and also define keyword variable
  254. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  255. _DATA    SEGMENT word public 'DATA'
  256.  
  257.     ;set up new stack
  258.     dw    256 dup ('SS')
  259.     MainStackEnd    label     word
  260.  
  261.     ;Keyword that will be used in C program
  262.     public    _Keyword
  263.     public    _MyHeaderSegment
  264.  
  265.     _Keyword        dw     0
  266.     _MyHeaderSegment    dw    0
  267.  
  268. _DATA    ENDS
  269.  
  270.     end    VAPStart
  271.